﻿using System;
using System.Collections.Generic;
using System.Configuration;
using System.Linq;
using System.Text;
using Medianamik.Core.Configuration;
using Medianamik.Core.Interfaces;

namespace Medianamik.Core.Resources
{
    public static class ResourcesUtil
    {
        static readonly MedianamikConfigSection Config = (MedianamikConfigSection)ConfigurationManager.GetSection(ConfigurationSectionName.MEDIANAMIK);

        public static MedianamikAssemblyCollection GetAssemblyCollection()
        {
            var assemblies = new List<IMedianamikAssembly>()
             {
                 GetWebAssembly(),
                 //new MedianamikAssembly("~/Medianamik/Blog", "Medianamik.UI.Blog.dll", 1),
                 //new MedianamikAssembly("~/Medianamik/Mediasend", "Medianamik.UI.Mediasend.dll", 1),
                 //new MedianamikAssembly("~/medianamik/forums", "Medianamik.UI.Web.Forum.dll", 1),
                 //new MedianamikAssembly("~/Medianamik/activeDirectory", "Medianamik.Service.ActiveDirectory.dll", 1)
             };

            foreach(var assembly in Config.VirtualFilePathAssemblies.Cast<VirtualFilePathAssembly>())
            {
                assemblies.Add(new MedianamikAssembly(assembly.RelativePath, assembly.Assembly, 1));
            }

            return new MedianamikAssemblyCollection(assemblies);
        }

        public static MedianamikAssembly GetWebAssembly()
        {
            return new MedianamikAssembly("~/medianamik", "Medianamik.UI.Web.dll", 0);
        }
    }
}
